<template>
    <div id="app">
        <el-container>
            <el-header>公司信息管理系统</el-header>
            <el-container>
                <el-aside width="200px">
                    <el-menu :default-openeds="['1', '3']">
                        <el-submenu index="1">
                            <template slot="title"><i class="el-icon-message"></i>系统信息管理</template>
                            <el-menu-item-group>
                                <el-menu-item index="1-1">
                                    <router-link to="/dept">部门信息管理</router-link>
                                </el-menu-item>
                                <el-menu-item index="1-2">
                                    <router-link to="/emp">员工信息管理</router-link>
                                </el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="2">
                            <template slot="title"><i class="el-icon-menu"></i>信息来源分析</template>
                            <el-menu-item-group>
                                <template slot="title">社会来源</template>
                                <el-menu-item index="2-1">问卷调查</el-menu-item>
                                <el-menu-item index="2-2">街头调研</el-menu-item>
                            </el-menu-item-group>
                            <el-menu-item-group title="内部来源">
                                <el-menu-item index="2-1">员工会议</el-menu-item>
                                <el-menu-item index="2-2">抽调评测</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="3">
                            <template slot="title"><i class="el-icon-setting"></i>信息处理</template>
                            <el-menu-item-group>
                                <template slot="title">打包发布</template>
                                <el-menu-item index="3-1">打包为压缩包</el-menu-item>
                                <el-menu-item index="3-2">生成PDF调查文件</el-menu-item>
                            </el-menu-item-group>
                            <el-menu-item-group title="信息过滤">
                                <el-menu-item index="3-3">自定义过滤</el-menu-item>
                                <el-menu-item index="3-4">常规过滤</el-menu-item>
                            </el-menu-item-group>
                            <el-submenu index="3-5">
                                <template slot="title">分享</template>
                                <el-menu-item index="3-5-1">发布到抖音</el-menu-item>
                                <el-menu-item index="3-5-2">发布到微信</el-menu-item>
                                <el-menu-item index="3-5-2">发布到小红书</el-menu-item>
                            </el-submenu>
                        </el-submenu>
                    </el-menu>
                </el-aside>
                <el-main>
                    <el-form :inline="true" :model="searchUserInfo" class="demo-form-inline">
                        <el-form-item label="姓名">
                            <el-input v-model="searchUserInfo.name" placeholder="姓名"></el-input>
                        </el-form-item>

                        <el-form-item label="性别">
                            <el-select v-model="searchUserInfo.gender" placeholder="性别">
                                <el-option label="男" value="male"></el-option>
                                <el-option label="女" value="female"></el-option>
                            </el-select>
                        </el-form-item>

                        <el-form-item label="入职时间">
                            <el-col :span="11">
                                <el-date-picker type="date" placeholder="选择日期" v-model="searchUserInfo.date1"
                                    style="width: 100%;"></el-date-picker>
                            </el-col>
                            <el-col class="line" :span="2">-</el-col>
                            <el-col :span="11">
                                <el-time-picker placeholder="选择时间" v-model="searchUserInfo.date2"
                                    style="width: 100%;"></el-time-picker>
                            </el-col>
                        </el-form-item>

                        <el-form-item>
                            <el-button type="primary" @click="onSubmit">查询</el-button>
                        </el-form-item>
                    </el-form>
                    <el-table :data="tableData" style="width: 100%">
                        <el-table-column prop="name" label="姓名" width="140">
                        </el-table-column>
                        <el-table-column prop="gender" label="性别" width="140">
                            <template slot-scope="scope">
                                {{ scope.row.gender == 1 ? '男' : '女' }}
                            </template>
                        </el-table-column>
                        <el-table-column prop="job" label="职位" width="140">
                        </el-table-column>
                        <el-table-column prop="entrydate" label="入职时间" width="140">
                        </el-table-column>
                        <el-table-column prop="updatetime" label="最近操作时间" width="180">
                        </el-table-column>
                        <el-table-column label="操作" width="150">
                            <el-button type="primary" size="mini">编辑</el-button>
                            <el-button type="danger" size="mini">删除</el-button>
                        </el-table-column>
                    </el-table>

                    <div class="block">
                        <el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange"
                            :current-page="currentPage" :page-sizes="[10, 20, 30, 40]" :page-size="10"
                            layout="total, sizes, prev, pager, next, jumper" :total="tableDataLength">
                        </el-pagination>
                    </div>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script>
import axios from 'axios'

export default {
    data() {
        return {
            tableData: [],
            multipleSelection: [],
            searchUserInfo: {
                name: '',
                gender: '',
                date1: '',
                date2: ''
            },
            currentPage: 1,
            tableDataLength:null
        }
    },

    methods: {
        toggleSelection(rows) {
            if (rows) {
                rows.forEach(row => {
                    this.$refs.multipleTable.toggleRowSelection(row);
                });
            } else {
                this.$refs.multipleTable.clearSelection();
            }
        },
        handleSelectionChange(val) {
            this.multipleSelection = val;
        },
        onSubmit() {
            alert(1)
        },
        handleSizeChange(val) {
            console.log(`每页 ${val} 条`);
        },
        handleCurrentChange(val) {
            console.log(`当前页: ${val}`);
        }
    },
    mounted() {
        axios.get('https://76b9ce4f-aca7-4292-96c0-7879b8260d59.mock.pstmn.io/').then(response => {
            this.tableData = response.data
            this.tableDataLength = response.data.length
        })
    }
}
</script>

<style>
/* .el-header,
.el-footer {
    background-color: #B3C0D1;
    color: #333;
    text-align: center;
    line-height: 60px;
}

.el-aside {
    background-color: #D3DCE6;
    color: #333;
    text-align: center;
    line-height: 200px;
}

.el-main {
    background-color: #E9EEF3;
    color: #333;
    text-align: center;
    line-height: 160px;
}

body>.el-container {
    margin-bottom: 40px;
}

.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {
    line-height: 260px;
}

.el-container:nth-child(7) .el-aside {
    line-height: 320px;
} */
</style>